package view;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class Index {

	private JFrame frame;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Index window = new Index();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Index() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setVisible(true);
		frame.setBounds(100, 100, 668, 362);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JButton button = new JButton("模拟时间片轮转算法");
		button.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new RRview();
			}
		});
		button.setBounds(94, 197, 188, 43);
		frame.getContentPane().add(button);
		
		JButton button_1 = new JButton("模拟优先级算法");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				new Priview();
			}
		});
		button_1.setBounds(362, 197, 188, 43);
		frame.getContentPane().add(button_1);
		
		JLabel label = new JLabel("进程调度算法模拟系统");
		label.setFont(new Font("宋体", Font.PLAIN, 25));
		label.setBounds(202, 13, 261, 111);
		frame.getContentPane().add(label);
		
		JButton button_2 = new JButton("退出系统");
		button_2.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				frame.dispose();//关闭窗口
			}
		});
		button_2.setForeground(Color.RED);
		button_2.setBounds(257, 253, 130, 35);
		frame.getContentPane().add(button_2);
	}
}
